package com.yzpass.api.user.mapper;

import com.yzpass.api.user.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.UUID;


/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author junfeng
 * @since 2025-01-22
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {

    @Select("select * from yu_user where user_id = #{id}::uuid")
    User selectById(@Param("id")String id);

    @Select("select distinct res_id from yu_role_res yrr where role_id in(\n" +
            "select role_id from yu_user_role yur where user_id = #{id}::uuid)")
    List<String> selectMenus(@Param("id") UUID id);

}

